
package com.starshineworks.util.actions;

import com.starshineworks.entities.UserE;

import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class ActionDelete extends Action {
        
    @Override
    public boolean perform(HttpServletRequest  request, 
                           HttpServletResponse resp,
                           HttpServlet serv,
                           boolean isMultiPart)
    {  
        Map<String,String[]> map = request.getParameterMap();
        HttpSession sess = request.getSession();
        boolean done = false;
        if (sess != null) {
            Integer uId = (Integer) sess.getAttribute("uId");
            if (uId != null) { 
                done = UserE.delete(uId);
            }
            sess.invalidate();
        }
        return done;
    }
    
    @Override
    public String getNextPage() {
        return "Solong";
    }
}
